Platform Explorer / Nuxeo Platform LTS 2017 9.10

Component org.nuxeo.ecm.platform.rendition.service.RenditionService

Documentation

The Rendition Service handles the registered rendition definitions and the rendering of a document based on a rendition definition. It provides an extension point to register rendition definitions.

Implementation

Class: org.nuxeo.ecm.platform.rendition.service.RenditionServiceImpl

Services

Extension Points

XML Source

<?xml version="1.0"?>
<component name="org.nuxeo.ecm.platform.rendition.service.RenditionService">

  <documentation>
    The Rendition Service handles the registered rendition definitions and
    the rendering of a document based on a rendition definition.
    It provides an extension point to register rendition definitions.

    @author Thomas Roger (troger@nuxeo.com)
  </documentation>

  <implementation
    class="org.nuxeo.ecm.platform.rendition.service.RenditionServiceImpl" />

  <service>
    <provide interface="org.nuxeo.ecm.platform.rendition.service.RenditionService" />
  </service>

  <extension-point name="renditionDefinitions">
    <documentation>
      Extension point to register rendition definitions.
      For instance, here is one defining a PDF rendition.
      <code>
        <renditionDefinition name="pdf" enabled="true">
          <label>label.rendition.pdf</label>
          <operationChain>blobToPDF</operationChain>
        </renditionDefinition>
      </code>

      Since 6.0:
      <ul>
         <li> a new allowEmptyBlob tag has been added. Setting it's value to true will allow the rendition to be available even if the target Document does not contains a Blob.</li>
         <li> a new visible attribute has been added. Setting it's value to false will allow the rendition to be hidden from the UI services.</li>
      </ul>

    </documentation>
    <object class="org.nuxeo.ecm.platform.rendition.service.RenditionDefinition" />
  </extension-point>

  <extension-point name="renditionDefinitionProviders">
    <documentation>

    </documentation>
    <object class="org.nuxeo.ecm.platform.rendition.service.RenditionDefinitionProviderDescriptor" />
  </extension-point>

  <extension-point name="storedRenditionManagers">
    <documentation>
      Extension point to register a StoredRenditionManager which overrides the DefaultStoredRenditionManager.
    </documentation>
    <object class="org.nuxeo.ecm.platform.rendition.service.StoredRenditionManagerDescriptor" />
  </extension-point>

  <extension-point name="defaultRendition">
    <documentation>
      Defines the default rendition of a given document. Contributions are of the form:
      <code>
        <defaultRendition>
          <script language="JavaScript">
            function run() {
              if (CurrentUser.getName() != "bob") {
                return null;
              }
              if (!CurrentUser.getGroups().contains("members")) {
                return 'aRenditionName`;
              }
              if (Document.getPropertyValue("dc:format") != "pdf") {
                return 'pdfRendition';
              }
              if (Reason == "download" || doc.getType() == "Picture") {
                return 'watermarkedImageRendition';
              }
              return 'aDefaultRendition';
          </script>
        </defaultRendition>
      </code>
      The language can be any JVM scripting language, the default is "JavaScript".

      The script must define a "run()" function that returns a string which is the name of the rendition to be used.
      The method will get called with the following global context (some values may be null):
      Document (DocumentModel) CurrentUser (NuxeoPrincipal),
      Reason (String), Infos (Map).
    </documentation>
    <object class="org.nuxeo.ecm.platform.rendition.service.DefaultRenditionDescriptor" />
  </extension-point>

</component>